
<template>
     
  <div class="home">
    <!-- 搜索 -->
    <div class="ss">
      <input type="text" placeholder="搜索商品 分类功效" @click="gosearch" />
      <img src="../../assets/image/search_list2.png" alt="" />
    </div>
    <!--  -->

    <van-tabs>
      <van-tab title="首页">
        <van-tabs>
          <van-tab title="今日10点上线">
            <div
              v-for="item in goodsList"
              :key="item.goods_id"
              class="goods"
              @click="shajd(item.goods_id)"
            >
              <div>
                <img :src="`http://websong.wang:4000/static/product-icon/${item.icon}`" alt=""   
                style="width: 50%; height: 50%; margin-left:20px ">
              </div>
              <div>
                <p>{{ item.goods_name }}</p>
                <p>
                  <span style="color: red">￥{{ item.group_price| float}}</span>
                  <span style="color: gray; font-size: 14px"
                    ><s>￥{{ item.market_price }}</s></span
                  >
                </p>

                <p style="font-size: 14px; color: gray">
                  {{ item.quantity }}条评论
                </p>
              </div>
            </div>

          </van-tab>
          <van-tab title="明日10点上线"></van-tab>
        </van-tabs>
      </van-tab>
      <van-tab title="极速免税店">内容 2</van-tab>
      <van-tab title="母婴">内容 3</van-tab>
      <van-tab title="轻奢">内容 4</van-tab>
      <van-tab title="名品特卖">内容 5</van-tab>
    </van-tabs>
   
  </div>
</template>

<script>
import { fetchData } from "../../api/goods";
export default {
  data() {
    return {
      goodsList: [],
      active: 0,
      //  page:1,
      // number:6,
      // totals:0,
      // host:''
    };
  },
  mounted(){
    fetchData().then(res=>{
        this.goodsList = res.data.result.list;
      })
  },

  methods: {
  
    shajd(id){
         this.$router.push({path:"/detail",query:{id:id}})

    },
    gosearch(){
      this.$router.push('/search')
    }
    
  },
  components: {},
};
</script>

<style lang='scss' scoped>
* {
  margin: 0;
  padding: 0;
}
.home{
  padding-top: 50px;
}
.goods {
  display: flex;
  align-items: center;
  padding-bottom: 20px;
}
.header {
  width: 100%;
  justify-content: space-between;
  align-items: center;
  display: flex;
  img {
    width: 10%;
    height: 40px;
  }
  .s2 {
    width: 25%;
    height: 40px;
    border-radius: 8px;
    text-align: center;
    line-height: 40px;
    border: 1px solid #ccc;
  }
}
.ss {
  position: fixed;
  top:0;
  left:0;
  z-index: 1;
  width: 100%;
  height: 80px;
  line-height: 80px;
  display: flex;
  text-align: center;
  justify-content: space-between;
  input {
    width: 70%;
    height: 30px;
    text-align: center;
    border-radius: 30px;
    margin-left: 20px;
    margin-top: 10px;
  }
  img {
    width: 10%;
    height: 30px;
    margin-right: 20px;
    margin-top: 10px;
  }
}
.d1 {
  width: 100%;
  height: 200px;
  display: flex;
  border: 1px solid #ccc;
  .d2 {
    width: 50%;
    height: 200px;
    img {
      width: 100%;
      height: 100%;
    }
  }
  .d3 {
    width: 50%;
    height: 200px;
  }
}
</style>
